package light.head.model.inv;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * 商品详情
 * @author yuleidian
 *
 */
@Entity
@Table
public class InvCommodityItem implements Serializable{
	private static final long serialVersionUID = -1159589501236147876L;
	
	private Integer code;				// 流水号
	private Integer cc;					// 商品信息编号
	private String name;				// 商品名称
	private Integer oc;					// 机构编号
	private String fast;				// 快记码
	private Double price;				// 成本价
	private Double rp;					// 零售价
	private Integer uc;					// 单位
	private Boolean deleted;			// 是否删除
	private Byte snc;					// 序列号(1.没有序列号 2.一类序列号 3.唯一序列号)
	private String un;
	private String cname;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Integer getCc() {
		return cc;
	}
	@Column
	public Byte getSnc() {
		return snc;
	}
	@Column
	public String getFast() {
		return fast;
	}
	@Column
	public Double getPrice() {
		return price;
	}
	@Column
	public Double getRp() {
		return rp;
	}
	@Column
	public Integer getUc() {
		return uc;
	}
	@Column
	public String getName() {
		return name;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Formula("(SELECT u.name FROM InvUnit u WHERE u.code = uc)")
	public String getUn() {
		return un;
	}
	@Formula("(SELECT u.name FROM InvCommodityInfo u WHERE u.code = cc)")
	public String getCname() {
		return cname;
	}
	
	
	
	
	
	
	
	
	
	
	public void setName(String name) {
		this.name = name;
	}
	public void setCname(String cname) {
		this.cname = cname;
	}
	public void setUn(String un) {
		this.un = un;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setCc(Integer cc) {
		this.cc = cc;
	}
	public void setFast(String fast) {
		this.fast = fast;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public void setRp(Double rp) {
		this.rp = rp;
	}
	public void setUc(Integer uc) {
		this.uc = uc;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setSnc(Byte snc) {
		this.snc = snc;
	}
	
}
